/* DATA STRUCTURES IN C Practice Project
     1. Linear List
        (1) Sequential List  -> (2) Linked List

* * * * * * * * * * * * * * * * * * * * * * * * * * * *
*                                                     *
*  - Copyright (c) 2025 XU Tao rights reservrd.       *
*  - Authored by Mr. Xu Tao on 2025/4/15              *
*  - Gitee: @zefeng97 | E-Mail: xutal@qq.com          *
*  - Algorithm :                                      *
*       InitList     GetList         Locate_Value     *
*       Insert_List  Locate_Address  Del_List         *
*       Clean_List   EnterList_H     EnterList_R      *
*                                                     *
* * * * * * * * * * * * * * * * * * * * * * * * * * * */

#pragma once
#define _CRT_SECURE_NO_WARNINGS 1 //取消VS编译器的某警告
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ERROR -1 //定义错误值,仅用作本程序表达使用

//定义学生信息结构体
typedef struct {
    int stu_no;
    char name[10];
    char sex[6];
}Student;

//定义学籍链表结构体
typedef struct stu_list {
    Student Data;
    struct stu_list* next;
}Stu_List,*SL;

//初始化算法
int InitList(SL* L);
//取值算法
int GetList(const SL L, const int i, Student* data);
//按数值查找
int Locate_Value(const SL L,const char* name);
//按地址查找
int Locate_Address(const SL L,int i , char* name);
//插入数据元素
int Insert_List(SL L, int i, const Student insert);
//删除数据元素
int Del_List(SL L, int i, Student* del);
//清空链表
int Clean_List(SL L);
//前插法录入链表
int EnterList_H(SL L , int i);
//后插法录入链表
int EnterList_R(SL L, int i);